<template>
  <div id="app">
    <router-view v-if="isRouterAlive"></router-view>
    <player
      v-show="store.musicMes"
      v-bind:isSpecial="isSpecial"
      :isFull="store.isFullPlay"
      :class="{hidden:isHidden}"
    ></player>
  </div>
</template>

<script>
export default {
  name: "App",

  provide() {
    return {
      reload: this.reload
    };
  },
  data() {
    return {
      store: this.getStore(),
      isRouterAlive: true,
      musicMes: {},
      isSpecial: false, //判断是不是一级页面改变mini播放器的呃位置
      isHidden: false
    };
  },
  watch: {
    $route: "getPath"
  },
  methods: {
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(function() {
        this.isRouterAlive = true;
      });
    },
    getPath() {
      if (
        this.$route.path == "/login" ||
        this.$route.path == "/account" ||
        this.$route.path == "/index/batch-operation" ||
        this.$route.path == "/index/sea-election" ||
        this.$route.path == "/index/comment" ||
        this.$route.path == "/friend" ||
        this.$route.path == "/dynamicDetails" ||
        this.$route.path == "/index/confirm-order" ||
        this.$route.path == "/index/sea-activity" ||
        this.$route.path == "/openvip" ||
        this.$route.path == "/index/buy-flower" ||
        this.$route.path == "/index/sign-up" ||
        this.$route.path == "/index/edit-address" ||
        this.$route.path == "/index/look-show" ||
        this.$route.path == "/index/video-List" ||
        this.$route.path == "/index/video-Detail" ||
        this.$route.path == "/index/my-support" ||
        this.$route.path == "/index/my-Activity" ||
        this.$route.path == "/index/buy-detail" ||
        this.$route.path == "/signin-record" ||
        this.$route.path == "/index/order-list" ||
        this.$route.path == "/index/welfare" ||
        this.$route.path == "/index/music-vip" ||
        this.$route.path == "/index/single-buy"
      ) {
        this.isHidden = true;
      } else {
        this.isHidden = false;
      }
      if (
        this.$route.path == "/" ||
        this.$route.path == "/friend" ||
        this.$route.path == "/mine"
      ) {
        this.musicMes = window.localStorage.getItem("musicMes");
        this.isSpecial = true;
      } else {
        this.isSpecial = false;
      }
    }
  },
  components: {},
  created() {
    this.musicMes = window.localStorage.getItem("musicMes");
    if (
      this.$route.path == "/login" ||
      this.$route.path == "/account" ||
      this.$route.path == "/index/batch-operation" ||
      this.$route.path == "/index/sea-election" ||
      this.$route.path == "/index/comment" ||
      this.$route.path == "/friend" ||
      this.$route.path == "/dynamicDetails" ||
      this.$route.path == "/index/confirm-order" ||
      this.$route.path == "/index/sea-activity" ||
      this.$route.path == "/openvip" ||
      this.$route.path == "/index/buy-flower" ||
      this.$route.path == "/index/sign-up" ||
      this.$route.path == "/index/edit-address" ||
      this.$route.path == "/index/look-show" ||
      this.$route.path == "/index/video-List" ||
      this.$route.path == "/index/video-Detail" ||
      this.$route.path == "/index/my-support" ||
      this.$route.path == "/index/my-Activity" ||
      this.$route.path == "/index/buy-detail" ||
      this.$route.path == "/signin-record" ||
      this.$route.path == "/index/order-list" ||
      this.$route.path == "/index/welfare" ||
      this.$route.path == "/index/music-vip" ||
      this.$route.path == "/index/single-buy"
    ) {
      this.isHidden = true;
    } else {
      this.isHidden = false;
    }
    if (
      this.$route.path == "/" ||
      this.$route.path == "/friend" ||
      this.$route.path == "/mine"
    ) {
      this.musicMes = window.localStorage.getItem("musicMes");
      this.isSpecial = true;
    } else {
      this.isSpecial = false;
    }
  }
};
</script>

<style lang="scss">
@import "../static/css/common.scss";
@import "swiper/dist/css/swiper.css";
@import "../static/css/iconfont.css";
.hidden {
  display: none;
}
</style>
